<template>
  <div>
    <div v-if="isCompany" class="asideBar" >
      <div class="tap" @click="clickHandle(index,item.path)" v-for="(item,index) in aside2" :class="index==active?'active':''">
        <i :class="item.icon"> {{item.name}}</i>
      </div>
    </div>
    <div v-else class="asideBar" >
      <div class="tap" @click="clickHandle(index,item.path)" v-for="(item,index) in aside" :class="index==active?'active':''">
        <i :class="item.icon"> {{item.name}}</i>
      </div>

    </div>
  </div>



</template>

<script>
export default {
  name: "AdminAside",
  data(){
    return{
      isCompany:false,
      aside:[
        {name:'学生管理',icon:'el-icon-s-opportunity',path:'/management/university/stuList'},
        {name:'学生导入',icon:'el-icon-notebook-1',path:'/management/university/addStu'},
      ],
      aside2:[
        {name:'视频管理',icon:'el-icon-video-play',path:'/management/company/video'},
        {name:'题库管理',icon:'el-icon-notebook-2',path:'/management/company/practice'},
        {name:'岗位管理',icon:'el-icon-notebook-1',path:'/management/company/jobManage'},
        {name:'投递管理',icon:'el-icon-setting',path:'/management/company/postResume'}
      ],
    }
  },
  computed:{
    active(){

      let url=this.$route.fullPath
      console.log(url)
      if(url=='/management/company/video'||url=='/management/university/stuList'){
        return 0
      }else if(url=='/management/company/practice'||url=='/management/university/addStu'){
        return 1
      }else if(url=='/management/company/jobManage'){
        return 2
      }else {
        return 3
      }
    }
  },
  created() {
    // alert(this.$route.fullPath.slice(0,14))
    if(this.$route.fullPath.slice(0,19)=='/management/company'){
      this.isCompany=true
    }
  },
  methods:{
    clickHandle(index,path){
      this.$router.push(path)
    }
  }
}
</script>

<style scoped>
.asideBar{
  height: 100%;
  width:100%;
  background-color: rgba(24, 26, 26, 0.8);
}
.tap{
  /*transition: all .2s;*/
  cursor: pointer;
  height: 40px;
  width: 60%;
  line-height: 40px;
  box-sizing: border-box;
  padding-left: 20px;
  margin-bottom: 8px;
  color: white;
}
.active{
  width: 98%;
  transition: .3s;
  position: relative;
  background-color: rgba(255,255,255,.8);
  color: rgb(0,136,245);;
}

.tap:hover{
  color: rgb(0,136,245);
}

</style>
